package com.example.administrator.szb.xzyw;

import android.os.Bundle;
import android.support.annotation.IdRes;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.example.administrator.szb.R;
import com.example.administrator.szb.activity.base.BaseActivity;
import com.example.administrator.szb.bean.YWBDBean;
import com.example.administrator.szb.tinkerutil.SampleApplicationLike;
import com.example.administrator.szb.http.HttpUtil;
import com.example.administrator.szb.http.URLAddress;

import java.util.ArrayList;
import java.util.HashMap;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;


/**
 * Created by D N on 2017/10/12.
 */

public class BGZRActivity extends BaseActivity {
    @Bind(R.id.tjzl_radiobutton_choose_bgzc_bgzr)
    RadioButton tjzlRadiobuttonChooseBgzcBgzr;
    @Bind(R.id.tjzl_radiobutton_choose_xkzr_bgzr)
    RadioButton tjzlRadiobuttonChooseXkzrBgzr;
    @Bind(R.id.tjzl_radiogroup_choose_bgzr)
    RadioGroup tjzlRadiogroupChooseBgzr;
    @Bind(R.id.tjzl_edit_bghy_bgzc)
    EditText tjzlEditBghyBgzc;
    @Bind(R.id.tjzl_ll_bghy_bgzr)
    LinearLayout tjzlLlBghyBgzr;
    @Bind(R.id.tjzl_edit_hyyq_bgzr)
    EditText tjzlEditHyyqBgzr;
    @Bind(R.id.tjzl_ll_hyyq_bgzr)
    LinearLayout tjzlLlHyyqBgzr;
    @Bind(R.id.tjzl_edit_ylyq_bgzr)
    EditText tjzlEditYlyqBgzr;
    @Bind(R.id.tjzl_ll_ylyq_bgzr)
    LinearLayout tjzlLlYlyqBgzr;
    @Bind(R.id.tjzl_edit_zcgm_bgzr)
    EditText tjzlEditZcgmBgzr;
    @Bind(R.id.tjzl_ll_zcgm_bgzr)
    LinearLayout tjzlLlZcgmBgzr;
    @Bind(R.id.tjzl_text_rzzt_sgfs_bgzr)
    TextView tjzlTextRzztSgfsBgzr;
    @Bind(R.id.tjzl_ll_rzzt_sgfs_bgzr)
    LinearLayout tjzlLlRzztSgfsBgzr;
    @Bind(R.id.tjzl_ll_bgzr_bgzc)
    LinearLayout tjzlLlBgzrBgzc;
    @Bind(R.id.tjzl_text_sssc_bgzr)
    TextView tjzlTextSsscBgzr;
    @Bind(R.id.tjzl_ll_sssc_bgzr)
    LinearLayout tjzlLlSsscBgzr;
    @Bind(R.id.tjzl_edit_zsz_bgzr)
    EditText tjzlEditZszBgzr;
    @Bind(R.id.tjzl_ll_zsz_bgzr)
    LinearLayout tjzlLlZszBgzr;
    @Bind(R.id.tjzl_edit_ltsz_bgzr)
    EditText tjzlEditLtszBgzr;
    @Bind(R.id.tjzl_ll_ltsz_bgzr)
    LinearLayout tjzlLlLtszBgzr;
    @Bind(R.id.tjzl_edit_zgb_bgzr)
    EditText tjzlEditZgbBgzr;
    @Bind(R.id.tjzl_ll_zgb_bgzr)
    LinearLayout tjzlLlZgbBgzr;
    @Bind(R.id.tjzl_edit_cgbl_bgzr)
    EditText tjzlEditCgblBgzr;
    @Bind(R.id.tjzl_ll_cgbl_bgzr)
    LinearLayout tjzlLlCgblBgzr;
    @Bind(R.id.tjzl_edit_sgjd_bgzr)
    EditText tjzlEditSgjdBgzr;
    @Bind(R.id.tjzl_ll_sgjd_bgzr)
    LinearLayout tjzlLlSgjdBgzr;
    @Bind(R.id.tjzl_edit_sgnd_bgzr)
    EditText tjzlEditSgndBgzr;
    @Bind(R.id.tjzl_ll_sgnd_bgzr)
    LinearLayout tjzlLlSgndBgzr;
    @Bind(R.id.tjzl_edit_ssnd_bgzr)
    EditText tjzlEditSsndBgzr;
    @Bind(R.id.tjzl_ll_ssnd_bgzr)
    LinearLayout tjzlLlSsndBgzr;
    @Bind(R.id.tjzl_ll_bgzr_xkzr)
    LinearLayout tjzlLlBgzrXkzr;
    @Bind(R.id.tjzl_edit_lxr_bgzr)
    EditText tjzlEditLxrBgzr;
    @Bind(R.id.tjzl_ll_lxr_bgzr)
    LinearLayout tjzlLlLxrBgzr;
    @Bind(R.id.tjzl_edit_lxfs_bgzr)
    EditText tjzlEditLxfsBgzr;
    @Bind(R.id.tjzl_ll_lxfs_bgzr)
    LinearLayout tjzlLlLxfsBgzr;
    @Bind(R.id.tjzl_edit_yq_bgzr)
    EditText tjzlEditYqBgzr;
    @Bind(R.id.tjzl_test_zs_bgzr)
    TextView tjzlTestZsBgzr;
    @Bind(R.id.tjzl_button_tj_bgzr)
    Button tjzlButtonTjBgzr;
    @Bind(R.id.tjzl_text_bmxy_xydk)
    TextView tjzlTextBmxyXydk;

    private int counselor_id = 0;
    YWBDBean ywbdBean;
    ArrayList<String> info = new ArrayList<>();

    int position = 1;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.bgzr_activity);
        ButterKnife.bind(this);
        SampleApplicationLike.getActivitiesInstance().add(this);
        initToolbar(R.id.bgzr_toolbar_include, "并购转让");
        initRadioGroupListener();//切换监听

        requestData(getIntent().getIntExtra("id", -1));
        editListenter(tjzlEditYqBgzr, tjzlTestZsBgzr);//设置字数监听
        hasIntent();
    }
    private void hasIntent() {
        counselor_id = getIntent().getIntExtra("counselor_id",0);
    }

    private void requestData(int id) {
        HashMap<String, String> map = new HashMap<>();
        map.put("code", HttpUtil.getParam());
        map.put("business_id", id + "");
        map.put("counselor_id", counselor_id + "");
        HttpUtil.RequestGsonPost(SampleApplicationLike.getQueueInstance(), Request.Method.POST, YWBDBean.class, URLAddress.URLBASE + URLAddress.URL_BDYW, map, new Response.Listener() {
            @Override
            public void onResponse(Object response) {
                ywbdBean = (YWBDBean) response;
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError error) {
                error.toString();
            }
        });
    }

    private void initRadioGroupListener() {
        tjzlRadiogroupChooseBgzr.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup radioGroup, @IdRes int i) {
                switch (i){
                    case R.id.tjzl_radiobutton_choose_bgzc_bgzr:
                        tjzlLlBgzrBgzc.setVisibility(View.VISIBLE);
                        tjzlLlBgzrXkzr.setVisibility(View.GONE);
                        break;
                    case R.id.tjzl_radiobutton_choose_xkzr_bgzr:
                        tjzlLlBgzrBgzc.setVisibility(View.GONE);
                        tjzlLlBgzrXkzr.setVisibility(View.VISIBLE);
                        break;
                }
            }
        });
    }

    @OnClick({R.id.tjzl_ll_bghy_bgzr, R.id.tjzl_ll_hyyq_bgzr, R.id.tjzl_ll_ylyq_bgzr, R.id.tjzl_ll_zcgm_bgzr, R.id.tjzl_ll_rzzt_sgfs_bgzr, R.id.tjzl_ll_bgzr_bgzc, R.id.tjzl_ll_sssc_bgzr, R.id.tjzl_ll_zsz_bgzr, R.id.tjzl_ll_ltsz_bgzr, R.id.tjzl_ll_zgb_bgzr, R.id.tjzl_ll_cgbl_bgzr, R.id.tjzl_ll_sgjd_bgzr, R.id.tjzl_ll_sgnd_bgzr, R.id.tjzl_ll_ssnd_bgzr, R.id.tjzl_ll_bgzr_xkzr, R.id.tjzl_ll_lxr_bgzr, R.id.tjzl_ll_lxfs_bgzr, R.id.tjzl_button_tj_bgzr, R.id.tjzl_text_bmxy_xydk})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.tjzl_ll_bghy_bgzr:
                break;
            case R.id.tjzl_ll_hyyq_bgzr:
                break;
            case R.id.tjzl_ll_ylyq_bgzr:
                break;
            case R.id.tjzl_ll_zcgm_bgzr:
                break;
            case R.id.tjzl_ll_rzzt_sgfs_bgzr:
                break;
            case R.id.tjzl_ll_bgzr_bgzc:
                break;
            case R.id.tjzl_ll_sssc_bgzr:
                break;
            case R.id.tjzl_ll_zsz_bgzr:
                break;
            case R.id.tjzl_ll_ltsz_bgzr:
                break;
            case R.id.tjzl_ll_zgb_bgzr:
                break;
            case R.id.tjzl_ll_cgbl_bgzr:
                break;
            case R.id.tjzl_ll_sgjd_bgzr:
                break;
            case R.id.tjzl_ll_sgnd_bgzr:
                break;
            case R.id.tjzl_ll_ssnd_bgzr:
                break;
            case R.id.tjzl_ll_bgzr_xkzr:
                break;
            case R.id.tjzl_ll_lxr_bgzr:
                break;
            case R.id.tjzl_ll_lxfs_bgzr:
                break;
            case R.id.tjzl_button_tj_bgzr:
                break;
            case R.id.tjzl_text_bmxy_xydk:
                break;
        }
    }
}
